function activateDivRadioSet(e) {
    var d = $(e);
 	d.children('.showradio').click(function(event) {
        var i1 = $(this).nextUntil('.showradio','.showdiv').first(), set = false;
        if ($(this).is(':checked')) {
            if (i1.is(":visible")) return;
		    d.children('.showdiv').each(function(index) {
                var i2 = $(this);
                if (!i2.is(':visible')) return;
                i2.css('height', i2.height()+"px");
				i2.slideUp(function() {
                    $(this).trigger('slidup');
                    i1.slideDown(function() {
                        i1.css('height', '');
                    });
                });
                set = true;
		    });
            if (!set) {
                i1.slideDown(function() {
                    i1.css('height', '');
                });
            }
        } else { /* handle the checkbox-unchecked case */
            i1.css('height', i1.height()+"px").slideUp();
        }
    });
	d.children('.showdiv').each(function(index) {
        /* this fixes the two issues that cause "jumping": margin-collapsing and incorrectly calculated heights */
        var t = $(this);
        t.css({"padding-top":"1px", "padding-bottom":"1px"});
        if (t.prevAll('.showradio:first').is(":not(:checked)")) {
    	    t.css({"height": t.height()+"px"}).hide();
        }
	});
};

// Sets up .click monitoring for click to show service
function setupClickToShowService() {


    $("a.sClickToShow").each(function () { 

            $(this).click(function () {

                if ($(this).text() == "Click to show") {
                    $(this).text("Click to hide");
                    $(this).siblings("span.numberOfServices").toggle();
                    $(this).siblings("span.serviceList").fadeToggle();
                }
                else {
                    $(this).text("Click to show");
                    $(this).siblings("span.serviceList").toggle();
                    $(this).siblings("span.numberOfServices").fadeToggle();
                }
                
            });
    }); 
   
};
